package com.yanmaohu.yulia.bean;

import java.util.List;

/**
 * @author Bright Lee
 */
public final class AlterIdentityColumnSpecification implements AlterColumnAction {

    private int beginIndex;
    private int endIndex;
    private final List<AlterIdentityColumnOption> alterIdentityColumnOptions;

    public AlterIdentityColumnSpecification(List<AlterIdentityColumnOption> alterIdentityColumnOptions) {
        this.beginIndex = alterIdentityColumnOptions.get(0).getBeginIndex();
        this.endIndex = alterIdentityColumnOptions.get(alterIdentityColumnOptions.size() - 1).getEndIndex();
        this.alterIdentityColumnOptions = alterIdentityColumnOptions;
    }

    @Override
    public int getBeginIndex() {
        return beginIndex;
    }

    @Override
    public int getEndIndex() {
        return endIndex;
    }

    public int size() {
        return alterIdentityColumnOptions.size();
    }

    public AlterIdentityColumnOption get(int index) {
        return alterIdentityColumnOptions.get(index);
    }

}
